﻿using System;
using System.Data;
using System.Configuration;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Dimok.Web.UI {
	public class TextBoxEncoded : TextBox {
		protected override void OnLoad(EventArgs e) {
			base.OnLoad(e);
			Attributes.Add("encode", "true");
			//if( ScriptManager.GetCurrent(Page).IsInAsyncPostBack )
			//  ScriptManager.RegisterOnSubmitStatement(this, GetType(), "Encode:" + ClientID,
			//    "if( $get('" + ClientID + "') )$get('" + ClientID + "').value=escape($get('" + ClientID + "').value);");
		}
		protected override void OnTextChanged(EventArgs e) {
			Text = Context.Server.UrlDecode(Text);
			base.OnTextChanged(e);
		}
	}
}
